class Animal {

    public constructor(public name: string, private sex: string) {

    }
    public move(distanceInMeters: number = 0) {
        console.log(`${this.name} moved ${distanceInMeters}m.`);
    }
    public say() {
        console.log(`我是 ${this.sex}`);
    }
}
class Snake extends Animal {
    constructor(name: string, sex: string) {
        super(name, sex);

    }
    move(distanceInMeters = 5) {
        console.log("Slithering...");
        super.move(distanceInMeters);
    }
    public sayName() {
        console.log(`我的名字${this.name}`);
        super.say()
    }
}

const snake1 = new Snake('snake', '男');
snake1.move();
snake1.sayName();


class Greeter {
    static standardGreeting = "Hello, there";
    greeting: string;
    greet() {
        if (this.greeting) {
            return "Hello, " + this.greeting;
        }
        else {
            return Greeter.standardGreeting;
        }
    }
}

let greeter1: Greeter;
greeter1 = new Greeter();
console.log(greeter1.greet());

let greeterMaker: typeof Greeter = Greeter;
greeterMaker.standardGreeting = "Hey there!";

let greeter2: Greeter = new greeterMaker();
console.log(greeter2.greet());